home *** CD-ROM | disk | FTP | other *** search
- Path: tor.teorfys.lu.se!coa
- From: coa@tor.teorfys.lu.se (Carl-Olof Almbadh)
- Newsgroups: comp.lang.c
- Subject: Re: void main() and other atrocities!
- Date: 15 Feb 1996 23:20:09 GMT
- Organization: Department of Theoretical Physics, Lund University
- Message-ID: <4g0f39$q41@merkurius.lu.se>
- References: <4eduaj$1aq@grouper.Exis.Net> <4em17r$shq@jaxnet.jaxnet.com> <6P/Hx0zpkXSB088yn@merlin.magic.mb.ca>
- NNTP-Posting-Host: tor.teorfys.lu.se
-
- In article <6P/Hx0zpkXSB088yn@merlin.magic.mb.ca>, wrightd@merlin.magic.mb.ca (David C. Wright) writes:
- |>
- |> My understanding is that declarations such as
- |>
- |> char *(buffer1[2]);
- |>
- |> and
- |>
- |> char **buffer2;
- |>
- > differs in only one respect. The constant 'buffer1' is an RVALUE. The
- > variable 'buffer2' is an LVALUE.
-
- In fact they are completely different. Both buffer1[i][j] and buffer2[i][j]
- are l-values but the compiler computes their addresses in different ways.
- The address of buffer1[i][j] is valuse stored is:
- buffer1 + (i+2 + j) * sizeof(char)
- There is only one referencing.
-
- In order to fetch buffer2[i][j] we must first fetch the char pointer
- buffer2[i] from memory. This new value is then incremented by j*sizeof(char)
- and one byte at the last address is fetched from memory.Thus there are
- two pointers involved, both of which must be referenced to fetch a char.
-
- Carl-OLof Almbladh
- Lund Univ.
- coa@teorfys.lu.se
-
-